package com.heima.comment.pojos;

import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 联想词表
 * </p>
 *
 * @author itheima
 */
@Data
@Document("ap_associate_words")
public class ApAssociateWords implements Serializable {

    private static final long serialVersionUID = 1L;

    private String id;

    /**
     * 文章id
     */
    private Long articleId;

    /**
     * 评论内容
     */
    private String content;

    /**
     * 评论id
     */
    private String commentId;

    /**
     * 评论作者
     */
    private String authorName;

    /**
     * 评论分类
     * 0 评论文章  1 对评论进行评论
     */
    private Short type;

    /**
     * 创建时间
     */
    private Date createdTime;

    /**
     * 点赞 :评论回复数
     * 0：点赞       1：取消点赞
     */
    private Short operation;

    /**
     * 点赞数
     */
    private Integer likes = 0;

    private Integer page;

    private Integer size;


    public void checkParam() {
        if (this.page == null || this.page < 0) {
            setPage(1);
        }
        if (this.size == null || this.size < 0 || this.size > 100) {
            setSize(10);
        }
    }

}